package mortal.game.resource
{
	import Message.Db.Tables.*;
	import com.gengine.resource.*;
	import flash.utils.*;
	
	public class BossRefreshConfig extends Object
	{
		private var _map:Dictionary;
		private static var _instance:BossRefreshConfig;
		
		public function BossRefreshConfig()
		{
			this._map = new Dictionary();
			if (_instance)
			{
				throw new Error("BossRefreshConfig is single");
			}
			this.init();
			
		}
		
		public function init() : void
		{
			var _loc_1:* = ConfigManager.instance.getJSONByFileName("t_boss_refresh.json");
			this.write(_loc_1);
			
		}
		
		private function write(param1:Object) : void
		{
			var _loc_2:TBossRefresh = null;
			var _loc_3:Object = null;
			for each (_loc_3 in param1)
			{
				
				_loc_2 = new TBossRefresh();
				_loc_2.id = _loc_3.id;
				_loc_2.mapId = _loc_3.mapId;
				_loc_2.plan = _loc_3.plan;
				_loc_2.code = _loc_3.code;
				_loc_2.refreshCount = _loc_3.refreshCount;
				_loc_2.distance = _loc_3.distance;
				_loc_2.interval = _loc_3.interval;
				_loc_2.byPoint = _loc_3.byPoint;
				_loc_2.direction = _loc_3.direction;
				_loc_2.ring = _loc_3.ring;
				_loc_2.route = _loc_3.route;
				this._map[_loc_2.id] = _loc_2;
			}
			
		}
		
		public function getInfoByCode(param1:int) : TBossRefresh
		{
			return this._map[param1];
		}
		
		public function getInfoByMapPlan(param1:int, param2:int) : Array
		{
			var _loc_3:TBossRefresh = null;
			var _loc_4:Array = [];
			for each (_loc_3 in this._map)
			{
				
				if (_loc_3.mapId == param1 && _loc_3.plan == param2)
				{
					_loc_4.push(_loc_3);
				}
			}
			return _loc_4;
		}
		
		public static function get instance() : BossRefreshConfig
		{
			if (!_instance)
			{
				_instance = new BossRefreshConfig;
			}
			return _instance;
		}
		
	}
}
